import *as actionType from './actionType'
import {fromJS} from 'immutable'

const defaultState=fromJS({
    focused:false,
    mouseIn:false,
    list:[],
    page:1,
    totalPage:1
})
export default (state=defaultState,action)=>{
    if(action.type===actionType.HEANDER_ITEM){
        return state.set('focused',true)
    }
    if(action.type===actionType.ADD_ITEM){
        return state.set('focused',false)
    }
    if(action.type===actionType.HANDER_LIST){
        return state.set('list',action.data).set('totalPage',action.totalPage) 
    }
    if(action.type===actionType.MOUSE_IN){
        return state.set('mouseIn',true)
    }
    if(action.type===actionType.MOUSE_OUT){
        return state.set('mouseIn',false)
    }
    if(action.type===actionType.CHANGE_LIST){
        return state.set('page',action.page)
    }
    return state
}

